package net.xiduth.game.player;

import java.util.TimerTask;

import net.xiduth.cores.CoresManager;

public class TimeManager {
 
	private transient Player player;
	
	public TimeManager(Player player) {
		this.player = player;
	}
	
	public void startTimer() {
	CoresManager.fastExecutor.schedule(new TimerTask() {
			int timer = 60;
			@Override
			public void run() {
				if (timer == 1) {
					player.setOnlineTime(player.getOnlineTime() + 1);
					timer = 60;
				}
				if (timer > 0) {
					timer--;
				}
			}
		}, 0L, 1000L);
	}
}